package cn.springcloud.fix.auth.granter;

import cn.springcloud.fix.auth.dao.entity.User;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.oauth2.common.exceptions.InvalidGrantException;
import org.springframework.stereotype.Service;

@Service
public class CustomUserDetailsService {

    public User loadUserByMobileAndPassword(String mobile, String password) {
        // if (StringUtils.isEmpty(mobile) || StringUtils.isEmpty(password)) {
        //     throw new InvalidGrantException("您输入的手机号或密码不正确");
        // }
        return null;
        // return new User("匿名者", mobile, "https://www.google.cn/favicon.ico", AuthorityUtils.commaSeparatedStringToAuthorityList("admin,user,root"));
    }

    public User loadUserByMobileAndSmscode(String mobile, String smscode) {
        // if (StringUtils.isEmpty(mobile) || StringUtils.isEmpty(smscode)) {
        //     throw new InvalidGrantException("您输入的手机号或短信验证码不正确");
        // }
        return null;
        // return new User("匿名者", mobile, "https://www.google.cn/favicon.ico", AuthorityUtils.commaSeparatedStringToAuthorityList("admin,user,root"));
    }
}
